package com.ruoyi.core.service.impl;

import com.alibaba.fastjson.JSON;
import com.ruoyi.common.core.domain.model.LoginBody;
import com.ruoyi.core.service.JsPluginService;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * @Author xiaom
 * @Date 2020/11/6 15:22
 * @Version 1.0.0
 * @Description <>
 **/
@Service
public class JsPluginServiceImpl implements JsPluginService {

    @Override
    public String login(LoginBody loginBody) {
        String info =  "{\n" +
                "    \"created_at\":\"2020-11-02T08:33:31.479Z\",\n" +
                "    \"status\":true,\n" +
                "    \"username\":\"wsm18719263446@163.com\",\n" +
                "    \"email\":\"wsm18719263446@163.com\",\n" +
                "    \"nickname\":\"Lol Pl\",\n" +
                "    \"message\":\"Successfully authenticated!\",\n" +
                "    \"daily_token\":\"\",\n" +
                "    \"language\":\"zh-Hant\",\n" +
                "    \"extension_info\":{\n" +
                "        \"id\":140,\n" +
                "        \"name\":\"Extension - Monthly Bundle\",\n" +
                "        \"unique_name\":\"Extension - Monthly Bundle\",\n" +
                "        \"group\":\"JSP\",\n" +
                "        \"activation_date\":1561334400000,\n" +
                "        \"expiration_date\":1736467200000,\n" +
                "        \"code\":\"JSP\",\n" +
                "        \"status\":\"Active\",\n" +
                "        \"expiration_reason\":\"\",\n" +
                "        \"price\":2000,\n" +
                "        \"charge_frequency\":1,\n" +
                "        \"billing_frequency\":\"monthly\",\n" +
                "        \"trial_period_days\":null,\n" +
                "        \"token\":\"d5800c39dcdc693381318b354e3345cd\",\n" +
                "        \"created_at\":1561396862000,\n" +
                "        \"access_right\":null,\n" +
                "        \"stripe_plan\":{\n" +
                "            \"id\":58,\n" +
                "            \"name\":\"Extension - Monthly Bundle - 20\",\n" +
                "            \"amount\":2000,\n" +
                "            \"interval\":\"month\",\n" +
                "            \"plan_id\":\"plan_FJYbC1ocr3fhoW\",\n" +
                "            \"currency\":\"usd\",\n" +
                "            \"statement_descriptor\":\"Jungle Scout\",\n" +
                "            \"interval_count\":1,\n" +
                "            \"rollback_stripe_plan_id\":null,\n" +
                "            \"legacy\":false,\n" +
                "            \"nickname\":\"Extension - Monthly Bundle - 20\",\n" +
                "            \"stripe_product_id\":26\n" +
                "        },\n" +
                "        \"details_updateable\":false,\n" +
                "        \"entity_type\":\"ExtensionType\",\n" +
                "        \"renewable\":true,\n" +
                "        \"creator\":{\n" +
                "            \"id\":250855,\n" +
                "            \"first_name\":\"Ryan\",\n" +
                "            \"last_name\":\"Kowtun\",\n" +
                "            \"email\":\"rkowtun@junglescout.com\"\n" +
                "        },\n" +
                "        \"roll_plan\":null,\n" +
                "        \"reactivable_only\":false,\n" +
                "        \"active_users_count\":8162,\n" +
                "        \"normalized_name\":\"Pro\",\n" +
                "        \"payment_plan\":\"Monthly\",\n" +
                "        \"destroyable\":false,\n" +
                "        \"has_keyword_spy_access\":null,\n" +
                "        \"has_launch_access\":null,\n" +
                "        \"checkout_line_items_attributes\":[\n" +
                "            {\n" +
                "                \"id\":43,\n" +
                "                \"body\":\"Jungle Scout Pro Chrome Extension\",\n" +
                "                \"position\":0\n" +
                "            }\n" +
                "        ],\n" +
                "        \"membership_type_stripe_plans\":null,\n" +
                "        \"onTrial\":false,\n" +
                "        \"transactionId\":\"et_Mzk4Nzk3\",\n" +
                "        \"createdAt\":\"2020-09-02T09:22:23.505Z\",\n" +
                "        \"availableActions\":[\n" +
                "\n" +
                "        ]\n" +
                "    },\n" +
                "    \"feature_access\":{\n" +
                "        \"database\":true,\n" +
                "        \"nicheHunter\":true,\n" +
                "        \"keywordScout\":true,\n" +
                "        \"supplierDatabase\":true,\n" +
                "        \"rankTracker\":true,\n" +
                "        \"remainingSearches\":{\n" +
                "            \"database\":-1,\n" +
                "            \"nicheHunter\":-1,\n" +
                "            \"keywordScout\":-1,\n" +
                "            \"supplierDatabase\":-1,\n" +
                "            \"extension\":10\n" +
                "        },\n" +
                "        \"remainingExports\":{\n" +
                "            \"productTracker\":7\n" +
                "        }\n" +
                "    }\n" +
                "}";
        HashMap map = JSON.parseObject(info, HashMap.class);
        return JSON.toJSONString(map);
    }
}
